package com.yubest.rabbitmq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FanoutConfig {

    @Bean
    public FanoutExchange testFanoutExchange(){
        return new FanoutExchange("test.fanout.exchange");
    }

    @Bean
    public Queue testFanoutQueue1(){
        return new Queue("test.fanout.queue1");
    }

    @Bean
    public Queue testFanoutQueue2(){
        return new Queue("test.fanout.queue2");
    }

    @Bean
    public Binding testFanoutBinding1(){
        return BindingBuilder.bind(testFanoutQueue1()).to(testFanoutExchange());
    }

    @Bean
    public Binding testFanoutBinding2(){
        return BindingBuilder.bind(testFanoutQueue2()).to(testFanoutExchange());
    }
}
